package io.zhengsh.juc._1aqs.liu666;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class Liu666LockTest {
    static volatile int idx = 0;

    public static void main(String[] args) {
        Liu666Lock lock = new Liu666Lock();

        for (int i = 0; i < 10; i++) {
            new Thread(() -> {
                lock.lock();
                idx++;
                log.info("thread = {}, idx = {}", Thread.currentThread().getName(), idx);
                lock.unlock();
            }, "t" + i).start();
        }
    }
}
